from django.conf.urls import url, include

from web.views import account, home, project, manage, wiki, file, setting

urlpatterns = [
    url(r'^register/$', account.register, name='register'),  # register
    url(r'^send/sms/$', account.send_sms, name='send_sms'),
    # 短信登陆
    url(r'^login/sms/$', account.login_sms, name='login_sms'),
    # 验证码登陆
    url(r'^login/imgsms/$', account.login_img_sms, name='login_img_sms'),

    url(r'^image/code/$', account.image_code, name='img_code'),
    url(r'^logout/$', account.logout, name='logout'),
    url(r'^index/$', home.index, name='index'),

    # 项目列表
    url(r'^project/list/$', project.project_list, name='project_list'),
    url(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_star, name='project_star'),
    url(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_unstar, name='project_unstar'),

    # 进入项目管理(路由分发)

    url(r'^manage/(?P<project_id>\d+)/', include([
        url(r'^dashboard/$', manage.dashboard, name='dashboard'),
        url(r'^issues/$', manage.issues, name='issues'),
        url(r'^statistics/$', manage.statistics, name='statistics'),

        url(r'^wiki/$', wiki.wiki, name='wiki'),
        url(r'^wiki/add/$', wiki.wiki_add, name='wiki_add'),
        url(r'^wiki/edit/(?P<wiki_id>\d+)/$', wiki.wiki_edit, name='wiki_edit'),
        url(r'^wiki/delete/(?P<wiki_id>\d+)/$', wiki.wiki_delete, name='wiki_delete'),
        url(r'^wiki/upload/$', wiki.wiki_upload, name='wiki_upload'),
        url(r'^wiki/catalog/$', wiki.wiki_catalog, name='wiki_catalog'),

        url(r'^file/file_list/$', file.file, name='file'),
        url(r'^file/file_delete/$', file.file_delete, name='file_delete'),
        url(r'^file/file_download/(?P<file_id>\d+)/$', file.file_download, name='file_download'),
        url(r'^file/cos_credential/$', file.cos_credential, name='cos_credential'),
        url(r'^file/post/$', file.file_post, name='file_post'),

        url(r'^setting/$', setting.setting, name='setting'),
        url(r'^setting/delete/$', setting.delete, name='setting_delete'),
    ], None, None)),

]
